package com.deyuanyun.pic.pipe.controller;

import com.deyuanyun.pic.cache.SessionCacheSupport2;
import com.deyuanyun.pic.controller.dto.UserSessionVO;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by xu on 2015/12/30.
 * 清管管理首页
 */
@Controller
@RequestMapping("pipe")
public class PipeIndexController extends PipeBaseController{

    /**
     * 清管管理首页
     * @param modelMap
     * @return
     */
    @RequestMapping("pipeIndex.html")
    public ModelAndView pipeIndex(ModelMap modelMap){
        UserSessionVO sessionVO= SessionCacheSupport2.getSessionVO();
        modelMap.put("userName",sessionVO.getUsername());
        return forword("/allmain",modelMap);
    }

    /**
     * 数据管理首页
     * @return
     */
    @RequestMapping("/PipeCrossDataM/pipeDataManager.html")
    public ModelAndView pipeDataManager(ModelMap modelMap){
        UserSessionVO sessionVO=SessionCacheSupport2.getSessionVO();
        sessionVO.getRoleIds();//code或者name
        if ("admin".equals(sessionVO.getUsername())){
            return forword("/pipe/datamanager/dataManager",modelMap);
        }else {
            return forword("/pipe/datamanager/dataManagerRead",modelMap);
        }

    }

}
